using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace NBear.IoC.Service.Services
{
    [Serializable]
    public abstract class BaseAutoService : BaseService, Castle.Model.IStartable
    {
        protected bool started = false;
        protected bool stopped = false;

        public BaseAutoService(string serviceName, IServiceMQ mq)
            : base(serviceName, mq)
        {
        }

        #region IStartable Members

        public virtual void Start()
        {
            if (started == true) return;
            WriteLog("Auto service: " + ServiceName + "[" + ClientId.ToString() + "] Started");
            started = true;
        }

        public virtual void Stop()
        {
            stopped = true;
            WriteLog("Auto service: " + ServiceName + "[" + ClientId.ToString() + "] Stoped");
        }

        #endregion
    }
}
